﻿<UserControl x:Class="Seems.SL.View.DiagramView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:beh="clr-namespace:Seems.View.Behaviors"
    xmlns:Controls="clr-namespace:Seems.View.Controls"
    xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
    mc:Ignorable="d"
    DataContext="{Binding LikeDiagram, Source={StaticResource Locator}}"
    d:DesignHeight="300" d:DesignWidth="400">
    
    <Grid x:Name="LayoutRoot">
        <Border Background="#01b0b0b0">
            <i:Interaction.Behaviors>
                <beh:ZoomOnWheelBehavior />
            </i:Interaction.Behaviors>
            <ScrollViewer x:Name="scroller"
                          HorizontalScrollBarVisibility="Auto"
                          VerticalScrollBarVisibility="Auto"
                          HorizontalContentAlignment="Stretch"
                          VerticalContentAlignment="Stretch"
                          Style="{StaticResource BlendScrollViewer}">
                <Controls:Contour x:Name="ItemsContainer"
        		                  Background="Transparent"
        		                  ItemsSource="{Binding ShownElements}">
                    <i:Interaction.Behaviors>
                        <beh:ZoomOnWheelBehavior/>
                        <beh:Panorama />
                    </i:Interaction.Behaviors>
                    <i:Interaction.Triggers>
                        <ei:PropertyChangedTrigger Binding="{Binding Scale}">
                            <ei:CallMethodAction MethodName="InvalidateMeasure"/>
                        </ei:PropertyChangedTrigger>
                    </i:Interaction.Triggers>

                    <Controls:Contour.RenderTransform>
                        <TransformGroup>
                            <TranslateTransform x:Name="ItemsContainerTranslateTransform" />
                            <ScaleTransform x:Name="ItemsContainerScaleTransform"
        					                ScaleX="{Binding Scale}"
        					                ScaleY="{Binding Scale}" />
                        </TransformGroup>
                    </Controls:Contour.RenderTransform>
                </Controls:Contour>
            </ScrollViewer>
        </Border>

        <Grid HorizontalAlignment="Right"
		      VerticalAlignment="Bottom"
		      Margin="0,0,20,20">
            <Border CornerRadius="8"
			        Background="#FF34567E"
			        Opacity="0.71"
			        Padding="5,5,5,5">
                <StackPanel Orientation="Vertical">
                    <Slider x:Name="ZoomSlider"
					        Orientation="Vertical"
					        Minimum="{Binding ScaleMin}"
					        Maximum="{Binding ScaleMax}"
					        LargeChange="{Binding ScaleLargeChange}"
					        SmallChange="{Binding ScaleSmallChange}"
					        Value="{Binding Scale, Mode=TwoWay}"
					        Width="50"
					        Height="75" />

                    <Button Height="25" Content="Auto Zoom" Command="{Binding ZoomToFitCommand}" CommandParameter="{Binding ElementName=root}" Margin="0,8,0,0">

                    </Button>
                </StackPanel>
            </Border>
        </Grid>
        <Button Content="Button" Height="23" HorizontalAlignment="Right" Margin="0,0,120,12" Name="button1"
                VerticalAlignment="Bottom" Width="75" Command="{Binding AddElementCmd}"/>
    </Grid> 
</UserControl>
